<template>
  <fly-popup ref="flyPopup">
    <view class="p-a-15 align-center fs-15">核销码</view>
    <view class="p-x-30 p-y-15 align-center">       
      <van-image fit="cover" width="360rpx" height="360rpx" :src="qrcode" />
    </view>
    <view class="p-x-30 m-y-15">
      <van-button type="info" size="small" block round @tap="handleClose">关闭并刷新</van-button>
    </view>
  </fly-popup>
</template>

<script>
import vueQr from '@/static/js/weapp-qrcode';
import flyPopup from '@/components/flyPopup';
export default {
  data(){
      return{
          qrcode: '/#'
      }
  },
  components:{
    flyPopup
  },
  methods:{
    init(id){
      this.qrcode = vueQr.drawImg(id, {
        typeNumber: 4,
        errorCorrectLevel: 'M',
        size: 300
      });
      this.$refs.flyPopup.init();
    },
    handleClose(){
      this.$refs.flyPopup.clickClose();
      this.$emit('close');
    }
  }
}
</script>